<?php $this->load->view('common/header'); ?>
<?php $this->load->view('home/header-common'); ?>
	<section id="home-apps">
		<div class="container">
			<div class="row-fluid">
				<div class="span3">
					<?php $this->load->view("home/left");?>
				</div>
				<div class="span9">
					<?php if (empty($apps)) {?>
					<p>没有应用</p>
					<?php } else { ?>
					<table class="table">
						<thead>
							<tr>
								<th>应用id</th>
								<th>应用名称</th>
								<th>是否绑定</th>
								<th>操作</th>
								<th>状态</th>
							</tr>
						</thead>
						<tbody>
							<?php foreach ($apps as $key => $value) {?>
							<tr>
								<td><?php echo $value["id"];?></td>
								<td><?php echo $value["appname"];?></td>
								<?php if ($value["isBind"] == 0) { echo "<td>未绑定</td><td><a href=\"".site_url("/home/bind/".$value["id"])."\" class=\"btn btn-primary\">我要绑定</a></td>";} else {echo "<td>已绑定</td><td><a href=\"".site_url("/home/deBind/".$value["id"])."\" class=\"btn alert-besure\" data-bb=\"confirm\" alert-message=\"确定需要解绑该应用么？\">我要解绑</a></td>";};?>
							</tr>
							<?php } ?>
							
						</tbody>
					</table>
					<?php } ?>
				</div>
			</div>
		</div>
	</section>
	<script type="text/javascript" src="<?php echo $this->config->item('public_path');?>js/bootstrapJS/bootbox.min.js"></script>
	<script>
		$('.alert-besure').click(function(){
			var url = $(this).attr("href");
			var message = $(this).attr("alert-message");
			if (!message) {
				message = "确定？"
			}
			bootbox.setLocale("zh_CN");
			bootbox.confirm(message,function(result){
				if (result) {
					window.location.href= url;
				}
			});
			return false;
		});

	</script>
</body>
</html>